<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="{{url_for('static',filename='js/jquery.min.js')}}"></script>
    <script src="{{url_for('static',filename='js/simulateTradeAccountInfo.js')}}"></script>
    <script src="{{url_for('static',filename='js/bootstrap.min.js')}}"></script>
    <script src="{{url_for('static',filename='js/jquery.dataTables.min.js')}}"></script>
    <link rel="stylesheet" href="{{url_for('static',filename='css/jquery.dataTables.min.css')}}">
    <link rel="stylesheet" href="{{url_for('static',filename='css/bootstrap.min.css')}}">
    <title>模拟交易</title>

</head>
<body>
        <nav class="navbar navbar-default" role="navigation">
    <div class="container-fluid">
    <div class="navbar-header">
        <a class="navbar-brand" href="#">盯盘宝后台管理系统</a>
    </div>
    <div>
        <ul class="nav navbar-nav">
            <li ><a href="{{ url_for('start_web') }}">首页</a></li>
            <li ><a href="{{ url_for('permission_manage') }}">权限配置</a></li>
        </ul>
        <ul class="nav navbar-nav navbar-right">
            <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                    管理员{{ session['admin'] if session['admin'] else "未登录" }}
                    <b class="caret"></b>
                </a>
                <ul class="dropdown-menu">
                    <li><a href="{{ url_for("login_out") }}">退出</a></li>
                </ul>
            </li>
        </ul>
    </div>
    </div>
</nav>
<div id="all_content" style="margin:auto; width:80%">

<!--最上面放buton    -->
<div align="center">

    <div class="btn-group btn-group-lg" role="group" aria-label="...">


        <div class="btn-group" role="group">
        <button type="button" class="btn btn-primary" onclick="simulateTradeRecordsForRc()">RC模拟交易记录</button>
        </div>

        <div class="btn-group" role="group">
        <button type="button" class="btn btn-primary" onclick="conditionFilter()">条件过滤</button>
        </div>

        <div class="btn-group" role="group">
        <button type="button" class="btn btn-primary" onclick="robotPanZhong()">盘中出手</button>
        </div>

    </div>
</div>
<!--最上面放buton    -->

<!--今日买卖记录-->
<div id="buy_sell_info">
    <div class="input-group col-xs-12">

    <select id="trade_date" class="simulate_trade form-control" style="margin:0px 20px 0px 0px;width:auto;">
    </select> <p style="font-size:22px;">模拟交易买卖记录</p>

    </div>

    <div style="margin:auto">
    <div class="input-group col-xs-12">
    <select id = "strategy_name" class="simulate_trade form-control" style="margin:0px 20px 0px 0px;width:auto;">
    </select>
    <select id="buy_or_sell" class="simulate_trade form-control" style="margin:0px 0px 0px 20px;width:auto;">
    <option value="buy">符合条件买入</option>
    <option value="fail_buy">不符合条件未买入</option>
    <option value="sell">当日卖出</option>
    </select>
    </div>
    <br/>
    <br/>
    </div>
    <div id="div_buy">
    <table id="example_buy" border="1" class="display" style="width:100%">
    </table>
    </div>
    <div id="div_fail_buy">
    <table id="example_fail_buy" border="1"  class="display" style="width:100%">
    </table>
    </div>
    <div id="div_sell">
    <table id="example_sell" border="1" class="display" style="width:100%">
    </table>
    </div>
    <br/>
    <br/>
</div>
<!--今日买卖记录-->
</div>

<script src="{{url_for('static',filename='js/getData_8_30.js')}}?{{version}}"></script>
<script type="text/javascript">

    function simulateTradeRecordsForRc() {
        window.open('./simulateTrade/simulateTradeForRc')
    }

    function conditionFilter(){
         window.open('./simulateTrade/conditionFilter')
    }

    function robotPanZhong(){
         window.open('./simulateTrade/robotPanZhong')
    }

    jQuery(document).ready(function () {
          loadDate();


          $(".simulate_trade").change(function(){
                refreshBuySellInfo("");
          });


        $('#example_buy').DataTable( {
        "paging":   false,
        "ordering": false,
        "info":     false,
        data: [],
        columns: [
            { title: "账户名" },
            { title: "交易时间" },
            { title: "股票代码" },
            { title: "股票名" },
            { title: "成交股数" },
            { title: "买卖金额" },
            {title:"买入均价"},
            { title: "当天是否炸板" },
            { title: "备注信息",width:"500px",
　　　　　　　"createdCell": function (td, cellData, rowData, row, col) {
　　　　　　　　$(td).attr('title', cellData);//设置单元格title，鼠标移上去时悬浮框展示全部内容
　　　　　　　　}
            },
            { title: "是否撤单及撤单时间",width:"500px",
　　　　　　　"createdCell": function (td, cellData, rowData, row, col) {
　　　　　　　　$(td).attr('title', cellData);//设置单元格title，鼠标移上去时悬浮框展示全部内容
　　　　　　　　}
            }]

        } );

        $('#example_fail_buy').DataTable( {

        "paging":   false,
        "ordering": false,
        "info":     false,
        data: [],
        columns: [
            { title: "账户名" },
            { title: "交易时间" },
            { title: "股票代码" },
            { title: "股票名" },
            {title:"不买原因"},
            { title: "备注信息",width:"500px",
　　　　　　　"createdCell": function (td, cellData, rowData, row, col) {
　　　　　　　　$(td).attr('title', cellData);//设置单元格title，鼠标移上去时悬浮框展示全部内容
　　　　　　　　}
            }]

        });

        $('#example_sell').DataTable({
        "paging":   false,
        "ordering": false,
        "info":     false,
        data: [],
        columns: [
            { title: "账户名" },
            { title: "交易时间" },
            { title: "股票代码" },
            { title: "股票名" },
            { title: "卖出股数" },
            { title: "卖出所得金额" },
            {title:"平均卖出价格"},

            { title: "备注信息",width:"500px",
　　　　　　　"createdCell": function (td, cellData, rowData, row, col) {
　　　　　　　　$(td).attr('title', cellData);//设置单元格title，鼠标移上去时悬浮框展示全部内容
　　　　　　　　}
            }]

        });


        changeDisplay('buy');

    });

    setTimeout(function () {
        refreshBuySellInfo("");
    },400);

    setInterval(function(){
        refreshBuySellInfo("");
    },30000);


</script>
</body>
</html>
